package com.sunk.mybatis.mymybatis.Configuration;


import com.sunk.mybatis.mymybatis.MyMapperProxy;

import java.lang.reflect.Proxy;

/**
 * @Author: Sunk 673116067@qq.com
 * @Date: 2018/10/10 14:38
 * @Description:
 */
public class SimpleSqlsession {
    private Excutor excutor=new SimpleExcutor();
    private MyConfiguration myConfiguration = new MyConfiguration();

    public <T> T selectOne(String statement,Object parameter){
        return excutor.query(statement, parameter);
    }
    public <T> T getMapper(Class<T> clas){
        return (T) Proxy.newProxyInstance(clas.getClassLoader(),new Class[]{clas}, new MyMapperProxy(myConfiguration,this));

    }

}
